﻿/********************************************************************************************
 * 文件名称:	Nation.cs
 * 设计人员:	yan(yanxianghui@gmail.com)
 * 设计时间:	2009-03-16
 * 功能描述:	关系
 * 注意事项:	
 * 版权所有:	Copyright (c) 2009, Fujian SIRC
 * 修改记录: 	修改时间		人员		修改备注
 *				    ----------		------		-------------------------------------------------
 *
 ********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using Shanfree.SharpMovie.Model;
using Shanfree.Framework.Utility;
using Shanfree.SharpMovie.IDAL;
using System.Data.SqlClient;
using System.Data;

namespace Shanfree.SharpMovie.SQLServerDAL
{
    /// <summary>
    /// 电影的制作国家
    /// </summary>
    public class MovieNationRelate : DBPersistenceBase<MovieNationRelateInfo>, IMovieNationRelate
    {
        #region SQL
        private const string SQL_SELECT_ALL = @"SELECT *
                                                                              FROM [dbo].[MovieNationRelate] WHERE MovieID = @MovieID";

        #endregion

        protected override string ConnectionString
        {
            get
            {
                return DBConnection.ConnectionString;
            }
        }

        #region INation 成员
        /// <summary>
        /// 
        /// </summary>
        /// <param name="movieID"></param>
        /// <returns></returns>
        public IList<MovieNationRelateInfo> GetList(string movieID)
        {
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@MovieID", movieID);
            SqlDataReader reader = SqlHelper.ExecuteReader(this.ConnectionString, CommandType.Text, SQL_SELECT_ALL, param);
            IList<MovieNationRelateInfo> list = GetListFromReader(reader);
            int pageSize = 100;
            CustomList<MovieNationRelateInfo> cList = PageAmoutHelper<MovieNationRelateInfo>.GetCutomList(this.ConnectionString, SQL_SELECT_ALL, param, pageSize, list);
            return cList;
        }

        #endregion
    }
}
